<!-- /* tagsMakerV01.js * gubhugreyot * sept 2012 * html tags maker */

var tipuanUrl = "http://gubhugreyot.blogspot.com/";
var grButtons = new Array();
var grLinks = new Array();
var grOpenTags = new Array();

function grButton(d, c, a, f, e, b) {
    this.id = d;
    this.display = c;
    this.tagStart = a;
    this.tagEnd = f;
    this.access = e;
    this.open = b
}
grButtons.push(new grButton("gr_html", "HTML", '<!DOCTYPE  html>\n<html>\n<head>\n<meta  http-equiv="Content-Type" content="text/html;  charset=UTF-8">\n<meta http-equiv="X-UA-Compatible"  content="IE=edge,chrome=1">\n<title>gubhugreyot....</title>\n\n\n</head>\n<body>\n\n\n</body>\n</html>', '<!DOCTYPE  html>\n<html>\n<head>\n<meta  http-equiv="Content-Type" content="text/html;  charset=UTF-8">\n<meta http-equiv="X-UA-Compatible"  content="IE=edge,chrome=1">\n<title>gubhugreyot....</title>\n\n\n</head>\n<body>\n\n\n</body>\n</html>', "doctype"));
grButtons.push(new grButton("gr_style", "<style>", '<style type="text/css" media="all">\n\n</style>\n\n', '<style type="text/css" media="all">\n\n</style>\n\n'));
grButtons.push(new grButton("gr_link_css", "link-css", '<link href="" rel="stylesheet" type="text/css" />\n', '<link href=".../style.css" rel="stylesheet" type="text/css" />\n'));
grButtons.push(new grButton("gr_script", "<script>", '<script type="text/javascript">\n\n<\/script>\n\n', '<script type="text/javascript">\n\n<\/script>\n\n'));
grButtons.push(new grButton("gr_link_js", "link-js", '<script src=".../javascript.js" type="text/javascript"><\/script>\n', '<script src=".../javascript.js" type="text/javascript"><\/script>\n'));
grButtons.push(new grButton("gr_cdata", "[CDATA[", "//<![CDATA[\n\n//]]>\n\n", "<!--\n\n//-->\n\n", "cDATA"));
grButtons.push(new grButton("gr_img_src", "img src", '<img src=".../image.jpg" width="" height="" border="0" />', '<img src=".../image.jpg" width="" height="" border="0" />'));
grButtons.push(new grButton("gr_b", "b", "<b></b>", "<b></b>", "b", "b"));
grButtons.push(new grButton("gr_strong", "strong", "<strong></strong>", "<strong></strong>", "strong"));
grButtons.push(new grButton("gr_i", "i", "<i></i>", "<i></i>", "i"));
grButtons.push(new grButton("gr_em", "em", "<em></em>", "<em></em>", "em"));
grButtons.push(new grButton("gr_p", "p", "<p></p>\n", "<p></p>\n", "p"));
grButtons.push(new grButton("gr_span", "span", "<span></span>", "<span></span>", "span"));
grButtons.push(new grButton("gr_div", "div", "<div></div>\n", "<div></div>\n", "div"));

grButtons.push(new grButton('gr_id','id', 'id=""', 'id=""', 'id'));

grButtons.push(new grButton("gr_class","class",'class=""','class=""',"class"));

grButtons.push(new grButton("gr_h1", "h1", "<h1></h1>\n", "<h1></h1>\n", "h1"));
grButtons.push(new grButton("gr_h2", "h2", "<h2></h2>\n", "<h2></h2>\n", "h2"));
grButtons.push(new grButton("gr_h3", "h3", "<h3></h3>\n", "<h3></h3>\n", "h3"));
grButtons.push(new grButton("gr_h4", "h4", "<h4></h4>\n", "<h4></h4>\n", "h4"));
grButtons.push(new grButton("gr_h5", "h5", "<h5></h5>\n", "<h5></h5>\n", "h5"));
grButtons.push(new grButton("gr_h6", "h6", "<h6></h6>\n", "<h6></h6>\n", "h6"));
grButtons.push(new grButton("gr_u", "u", "<u></u>", "<u></u>", "u"));
grButtons.push(new grButton("gr_ul", "ul", "<ul>\n\n</ul>\n\n", "<ul>\n\n</ul>\n\n", "ul"));
grButtons.push(new grButton("gr_ol", "ol", "<ol>\n\n</ol>\n\n", "<ol>\n\n</ol>\n\n", "ol"));
grButtons.push(new grButton("gr_li", "li", "\t<li></li>", "\t<li></li>", "li"));
grButtons.push(new grButton("gr_bquote", "bQuote", "<blockquote></blockquote>", "<blockquote></blockquote>", "bquote"));
grButtons.push(new grButton("gr_pre", "pre", "<pre></pre>\n", "<pre></pre>\n", "pre"));
grButtons.push(new grButton("gr_code", "code", "<code></code>", "<code></code>", "code"));
grButtons.push(new grButton("gr_table", "table", "<table>\n<tbody>\n\n</tbody>\n</table>\n\n\n\n", "<table>\n<tbody>\n\n</tbody>\n</table>\n\n\n\n", "table"));
grButtons.push(new grButton("gr_tr", "tr", "\t<tr>\n\n\t</tr>", "\t<tr>\n\n\t</tr>", "tr"));
grButtons.push(new grButton("gr_td", "td", "\t\t<td></td>", "\t\t<td></td>", "td"));
grButtons.push(new grButton("gr_dl", "dl", "<dl>\n</dl>\n", "<dl>\n</dl>\n", "dl"));
grButtons.push(new grButton("gr_dt", "dt", "\t<dt>\n\t</dt>\n", "\t<dt>\n\t</dt>\n", "dt"));
grButtons.push(new grButton("gr_dd", "dd", "\t<dd>\n\t</dd>\n", "\t<dd>\n\t</dd>\n", "dd"));
grButtons.push(new grButton("gr_form", "form", "<form>\n\n</form>\n\n", "<form>\n\n</form>\n\n", "form"));
grButtons.push(new grButton("gr_textarea", "textarea", "<textarea></textarea>\n", "<textarea></textarea>\n", "textarea"));
grButtons.push(new grButton("gr_button", "button", "<button></button>", "<button></button>", "button"));
grButtons.push(new grButton("gr_br", "<br />", "<br />\n", "<br />\n", "br"));
grButtons.push(new grButton("gr_clear_both", "clear_both", '<div style="clear:both;"></div>\n', '<div style="clear:both;"></div>\n', "Clear"));
grButtons.push(new grButton("gr_link", "link", "", "", "a"));
grButtons.push(new grButton("gr_ext_link", "ext-link", "", "", "e"));
grButtons.push(new grButton("gr_img", "img", "", "", "m", - 1));
var extendedStart = grButtons.length;
grButtons.push(new grButton("gr_ins", "ins", "<ins></ins>", "<ins></ins>"));
grButtons.push(new grButton("gr_del", "del", "<del></del>", "<del></del>"));
grButtons.push(new grButton("gr_nobr", "nobr", "<nobr></nobr>", "<nobr></nobr>"));
grButtons.push(new grButton("gr_css_ie", "css-IE", '<!--[if IE]>\n<style type="text/css">\n CSS here! (All IE)\n</style>\n<![endif]-->\n', '<!--[if IE]>\n/* All CSS * spesific for IE */\n<link href="all-IE.css" rel="stylesheet" type="text/css" />\n<![endif]-->\n', "CSS-IE"));
grButtons.push(new grButton("gr_ie_7", "IE 7", '<!--[if IE 7]>\n<style type="text/css">\n CSS IE 7 here! (Spesific for IE 7)\n Replace "7" with others spesific IE\n</style>\n<![endif]-->\n', '<!--[if IE 7]>\n/* Replace "7" with others spesific IE */\n<link href="spesific-IE-7.css" rel="stylesheet" type="text/css" />\n<![endif]-->\n', "IE 7"));
grButtons.push(new grButton("gr_ie8_ie6", "IE8-IE6", '<!--[if lte IE 8]>\n<style type="text/css">\nCSS for IE-8, IE-7 and down\n</style>\n<![endif]-->\n', '<!--[if lte IE 8]>\n /* css for IE-8, IE 7 and down */\n<link href="IE-8-and-down.css" rel="stylesheet" type="text/css" />\n<![endif]-->', "IE8-IE6"));
grButtons.push(new grButton("gr_ie6_ie8", "IE6-IE8", '<!--[if lte IE 6]>\n<style type="text/css">\ncss for IE-6, IE 7 and up\n</style>\n<![endif]-->\n', '<!--[if lte IE 6]>\n /* css for IE-6, IE 7 and up */\n<link href="IE-6-and-up.css" rel="stylesheet" type="text/css" />\n<![endif]-->', "IE6-IE8"));
grButtons.push(new grButton("gr_js_ie", "js-IE", '<!--[if IE]>\n<script type="text/javascript">\n javascript here! (All IE)\n<\/script>\n<![endif]-->\n', '<!--[if IE]>\n/* javascript spesific in IE */\n<script src="javascript-IE.js" type="text/javascript"><\/script>\n<![endif]-->\n', "CSS-IE"));
grButtons.push(new grButton("gr_hot", "HOT", '<a href="http://gubhugreyot.blogspot.com/" target="_blank" title="Best blogger tutorials">gubhugreyot</a>\n', '<a href="http://bestbloggerhack.blogspot.com/" target="_blank" title="Best blogger tricks and hacks">Best Blogger Hacks</a>\n', "HOT"));

function grLink(a, b, c) {
    this.display = a;
    this.URL = b;
    if (!c) {
        c = 0
    }
    this.newWin = c
}
grLinks[grLinks.length] = new grLink("gubhugreyot.blogspot.com", "http://gubhugreyot.blogspot.com/");

function grShowButton(b, d, c) {
    if (d.access) {
        var a = ' accesskey = "' + d.access + '"'
    } else {
        var a = ""
    }
    switch (d.id) {
    case "gr_img":
        document.write('<input type="button" id="' + d.id + "_" + b + '" ' + a + ' class="gr_button" onclick="grInsertImage(\'' + b + '\');" value="' + d.display + '" />');
        break;
    case "gr_link":
        document.write('<input type="button" id="' + d.id + "_" + b + '" ' + a + ' class="gr_button" onclick="grInsertLink(\'' + b + "', " + c + ');" value="' + d.display + '" />');
        break;
    case "gr_ext_link":
        document.write('<input type="button" id="' + d.id + "_" + b + '" ' + a + ' class="gr_button" onclick="grInsertExtLink(\'' + b + "', " + c + ');" value="' + d.display + '" />');
        break;
    case "gr_footnote":
        document.write('<input type="button" id="' + d.id + "_" + b + '" ' + a + ' class="gr_button" onclick="grInsertFootnote(\'' + b + '\');" value="' + d.display + '" />');
        break;
    case "gr_via":
        document.write('<input type="button" id="' + d.id + "_" + b + '" ' + a + ' class="gr_button" onclick="grInsertVia(\'' + b + '\');" value="' + d.display + '" />');
        break;
    default:
        document.write('<input type="button" id="' + d.id + "_" + b + '" ' + a + ' class="gr_button" onclick="grInsertTag(\'' + b + "', " + c + ');" value="' + d.display + '"  />');
        break
    }
}
function grShowLinks() {
    var a = '<select onchange="grQuickLink(this.options[this.selectedIndex].value, this);"><option value="-1" selected>(Quick Links)</option>';
    for (i = 0; i < grLinks.length; i++) {
        a += '<option value="' + i + '">' + grLinks[i].display + "</option>"
    }
    a += "</select>";
    document.write(a)
}
function grAddTag(b, a) {
    if (grButtons[a].tagEnd != "") {
        grOpenTags[b][grOpenTags[b].length] = a;
        document.getElementById(grButtons[a].id + "_" + b).value = "" + document.getElementById(grButtons[a].id + "_" + b).value
    }
}
function grRemoveTag(b, a) {
    for (i = 0; i < grOpenTags[b].length; i++) {
        if (grOpenTags[b][i] == a) {
            grOpenTags[b].splice(i, 1);
            document.getElementById(grButtons[a].id + "_" + b).value = document.getElementById(grButtons[a].id + "_" + b).value.replace("/", "")
        }
    }
}
function grCheckOpenTags(a, c) {
    var b = 0;
    for (i = 0; i < grOpenTags[a].length; i++) {
        if (grOpenTags[a][i] == c) {
            b++
        }
    }
    if (b > 0) {
        return true
    } else {
        return false
    }
}
function grCloseAllTags(b) {
    var a = grOpenTags[b].length;
    for (o = 0; o < a; o++) {
        grInsertTag(b, grOpenTags[b][grOpenTags[b].length - 1])
    }
}
function grQuickLink(a, b) {
    if (a > -1) {
        var d = "";
        if (grLinks[a].newWin == 1) {
            d = ' target="_blank"'
        }
        var c = '<a href="' + grLinks[a].URL + '"' + d + ">" + grLinks[a].display + "</a>";
        b.selectedIndex = 0;
        grInsertContent(grCanvas, c)
    } else {
        b.selectedIndex = 0
    }
}
function grSpell(c) {
    myField = document.getElementById(c);
    var b = "";
    if (document.selection) {
        myField.focus();
        var a = document.selection.createRange();
        if (a.text.length > 0) {
            b = a.text
        }
    } else {
        if (myField.selectionStart || myField.selectionStart == "0") {
            var e = myField.selectionStart;
            var d = myField.selectionEnd;
            if (e != d) {
                b = myField.value.substring(e, d)
            }
        }
    }
    if (b == "") {
        b = prompt('Enter the name of a woman and then click "OK":', "")
    }
    if (b != "") {
        window.open(tipuanUrl)
    }
}
function grHTMLtags(a) {
    document.write('<div id="gr_htmltags_' + a + '">');
    for (i = 0; i < extendedStart; i++) {
        grShowButton(a, grButtons[i], i)
    }
    if (grShowExtraCookie()) {
        document.write('<input type="button" id="gr_spell_' + a + '" class="gr_button" onclick="grSpell(\'' + a + '\');" value="BEST" />')
    } else {
        document.write('<input type="button" id="gr_spell_' + a + '" class="gr_button" onclick="grSpell(\'' + a + '\');" value="BEST" />')
    }
    for (i = extendedStart; i < grButtons.length; i++) {
        grShowButton(a, grButtons[i], i)
    }
    document.write("</div>");
    grOpenTags[a] = new Array()
}
function grInsertTag(c, a) {
    myField = document.getElementById(c);
    if (document.selection) {
        myField.focus();
        sel = document.selection.createRange();
        if (sel.text.length > 0) {
            sel.text = grButtons[a].tagStart + sel.text + grButtons[a].tagEnd
        } else {
            if (!grCheckOpenTags(c, a) || grButtons[a].tagEnd == "") {
                sel.text = grButtons[a].tagStart;
                grAddTag(c, a)
            } else {
                sel.text = grButtons[a].tagEnd;
                grRemoveTag(c, a)
            }
        }
        myField.focus()
    } else {
        if (myField.selectionStart || myField.selectionStart == "0") {
            var f = myField.selectionStart;
            var e = myField.selectionEnd;
            var d = e;
            var b = myField.scrollTop;
            if (f != e) {
                myField.value = myField.value.substring(0, f) + grButtons[a].tagStart + myField.value.substring(f, e) + grButtons[a].tagEnd + myField.value.substring(e, myField.value.length);
                d += grButtons[a].tagStart.length + grButtons[a].tagEnd.length
            } else {
                if (!grCheckOpenTags(c, a) || grButtons[a].tagEnd == "") {
                    myField.value = myField.value.substring(0, f) + grButtons[a].tagStart + myField.value.substring(e, myField.value.length);
                    grAddTag(c, a);
                    d = f + grButtons[a].tagStart.length
                } else {
                    myField.value = myField.value.substring(0, f) + grButtons[a].tagEnd + myField.value.substring(e, myField.value.length);
                    grRemoveTag(c, a);
                    d = f + grButtons[a].tagEnd.length
                }
            }
            myField.focus();
            myField.selectionStart = d;
            myField.selectionEnd = d;
            myField.scrollTop = b
        } else {
            if (!grCheckOpenTags(c, a) || grButtons[a].tagEnd == "") {
                myField.value += grButtons[a].tagStart;
                grAddTag(c, a)
            } else {
                myField.value += grButtons[a].tagEnd;
                grRemoveTag(c, a)
            }
            myField.focus()
        }
    }
}
function grInsertContent(c, a) {
    myField = document.getElementById(c);
    if (document.selection) {
        myField.focus();
        sel = document.selection.createRange();
        sel.text = a;
        myField.focus()
    } else {
        if (myField.selectionStart || myField.selectionStart == "0") {
            var e = myField.selectionStart;
            var d = myField.selectionEnd;
            var b = myField.scrollTop;
            myField.value = myField.value.substring(0, e) + a + myField.value.substring(d, myField.value.length);
            myField.focus();
            myField.selectionStart = e + a.length;
            myField.selectionEnd = e + a.length;
            myField.scrollTop = b
        } else {
            myField.value += a;
            myField.focus()
        }
    }
}
function grInsertLink(b, a, d) {
    myField = document.getElementById(b);
    if (!d) {
        d = "http://"
    }
    if (!grCheckOpenTags(b, a)) {
        var c = prompt("Enter the URL", d);
        if (c) {
            grButtons[a].tagStart = '<a href="' + c + '">gubhugreyot</a>';
            grInsertTag(b, a)
        }
    } else {
        grInsertTag(b, a)
    }
}
function grInsertExtLink(b, a, d) {
    myField = document.getElementById(b);
    if (!d) {
        d = "http://"
    }
    if (!grCheckOpenTags(b, a)) {
        var c = prompt("Enter the URL", d);
        if (c) {
            grButtons[a].tagStart = '<a href="' + c + '" rel="external">gubhugreyot</a>';
            grInsertTag(b, a)
        }
    } else {
        grInsertTag(b, a)
    }
}
function grInsertImage(b) {
    myField = document.getElementById(b);
    var a = prompt("Enter the URL of the image", "http://");
    if (a) {
        a = '<img src="' + a + '" alt="' + prompt("Enter a description of the image", "") + '" />';
        grInsertContent(b, a)
    }
}
function grSetCookie(e, b, d, c, a) {
    document.cookie = e + "=" + escape(b) + ((d) ? "; expires=" + d.toGMTString() : "") + ((c) ? "; path=" + c : "") + ((a) ? "; domain=" + a : "")
}
function grShowExtraCookie() {
    var a = document.cookie.split(";");
    for (var c = 0; c < a.length; c++) {
        var b = a[c];
        while (b.charAt(0) == " ") {
            b = b.substring(1, b.length)
        }
        if (b.indexOf("js_quicktags_extra") == 0) {
            if (b.substring(19, b.length) == "show") {
                return true
            } else {
                return false
            }
        }
    }
    return false
};
//-->